# import numpy as np
# import matplotlib.pylab as plt


# def relu(x):
#     return np.maximum(0, x)

# x = np.arange(-5.0, 5.0, 0.1)
# y = relu(x)
# plt.plot(x, y)
# plt.ylim(-1.0, 5.5)
# plt.show()
# coding: utf-8


# import numpy as np
# import matplotlib.pylab as plt


# def sigmoid(x):
#     return 1 / (1 + np.exp(-x))    

# X = np.arange(-5.0, 5.0, 0.1)
# Y = sigmoid(X)
# plt.plot(X, Y)
# plt.ylim(-0.1, 1.1)
# plt.show()

import numpy as np
import matplotlib.pylab as plt


def sigmoid(x):
    return 1 / (1 + np.exp(-x))    


def step_function(x):
    return np.array(x > 0, dtype=np.int)

x = np.arange(-5.0, 5.0, 0.1)
y1 = sigmoid(x)
y2 = step_function(x)

plt.plot(x, y1)
plt.plot(x, y2, 'k--')
plt.ylim(-0.1, 1.1) #指定图中绘制的y轴的范围
plt.show()